package com.tuantuan.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.tuantuan.dao.CourserListDao;
import com.tuantuan.model.Courselist;
import com.tuantuan.service.CourserListService;
import com.tuantuan.utils.LogUtils;

@Service
public class CourserListServiceImpl implements CourserListService {

	@Autowired
	private CourserListDao dao;
	@Override
	public String queryCourseList(String week) {
		List<Courselist> list=dao.queryCourseList(week);
		List<Map<String,String>> maplist=new ArrayList<Map<String,String>>();
		Map<String,String> map=null;
		for (Courselist co : list) {
			map=new HashMap<String, String>();
			map.put("beginClass", co.getBeginClass()+"");
			map.put("endClass", co.getEndClass()+"");
			map.put("days", co.getDays()+"");
			map.put("courseName", co.getCourseName());
			map.put("className", co.getClassName());
			map.put("tcname",co.getTcname());
			maplist.add(map);
		}
		LogUtils.audit(maplist.toString());
		return new Gson().toJson(maplist);
	}

}
